home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 May: Tool Chest / Dev.CD May 98 TC.toast / Tool Chest / Development Kits / HyperCard Related / APDA HyperCard Toolkits / CD Audio Toolkit 1.0 / Source / cd.h next >
Encoding:
C/C++ Source or Header  |  1995-02-07  |  4.8 KB  |  211 lines  |  [TEXT/MPS ]

  1. /************************************************************************
  2.  *
  3.  *  File:            cd.h
  4.  *
  5.  *  Purpose:        hold constants for audio access of
  6.  *                    AppleCD SC™ drive
  7.  *
  8.  *  Description:    This file contains all the constants necessary
  9.  *                    to access the AppleCD SC drive.  We define
  10.  *                    several variations on the CntrlParam data
  11.  *                    structure, since the driver requires strange
  12.  *                    formats for some of the inputs.
  13.  *
  14.  *    Copyright © 1988, Apple Computer, Inc.  All Rights Reserved.
  15.  *
  16.  ************************************************************************/
  17. #include <Types.h>
  18. #include <Memory.h>
  19. #include <OSUtils.h>
  20. #include <QuickDraw.h>
  21. #include <Resources.h>
  22. #include <Devices.h>
  23. #include <errors.h>
  24. #include <Files.h>
  25. #include <Serial.h>
  26. #include <Strings.h>
  27. #include <ToolUtils.h>
  28. #include <HyperXCmd.h>
  29.  
  30. #define    GLOBALNAME    "\pxxxCDRefNum"
  31. #define PLAYMODE    "\pxxxCDPlayMode"
  32. #define DRIVERNAME    "\pxxxCDDriverName"
  33.  
  34. /* There are 75 blocks per second of cd data.  */
  35. #define BLOCKSEC    75L                    /* blocks per second */
  36. #define    BLOCKMIN    4500L                /* blocks per minute */
  37.  
  38. /* Some constants, from the CD SC Developer's Guide chapter 7 */
  39. #define    AMSFADDR    1
  40. #define TRACKADDR    2
  41. #define BUFADDR        3
  42. #define    STEREO        9
  43. #define    INPROGRESS    0
  44.  
  45. /* Some commands, from the CD SC Developer's Guide chapter 7 */
  46. #define AEJECT    7
  47. #define READTOC    100
  48. #define READQ    101
  49. #define ASEARCH    103
  50. #define    APLAY    104
  51. #define APAUSE    105
  52. #define    ASTOP    106
  53. #define ASTATUS    107
  54. #define ASCAN    108
  55.  
  56. /* constants for the STR# resource which contains 
  57. ** our various strings (for easy localization)
  58. */
  59. #define    DRIVENAME    1
  60. #define    DISKTITLE    2
  61. #define    TRACKTITLE    3
  62. #define    DRIVER_STR    4
  63. #define    STR_ID        8078
  64.  
  65.  
  66. /* these two conversion routines assume that x is only 2 digits long */
  67. #define    BCD2DECIMAL(x)    ( (((x & 0xFF) >> 4) *10) + ((x & 0xFF) & 0x0F) )
  68. #define DECIMAL2BCD(x)  ( (((x & 0xFF) / 10) * 16) + ((x & 0xFF) % 10) )
  69.  
  70. /* This version uses csParam as chars, not shorts */
  71. typedef struct {
  72.     struct QElem *qLink;
  73.     short qType;
  74.     short ioTrap;
  75.     Ptr ioCmdAddr;
  76.     ProcPtr ioCompletion;
  77.     OSErr ioResult;
  78.     char *ioNamePtr;
  79.     short ioVRefNum;
  80.     short ioCRefNum;
  81.     short csCode;
  82.     char csParam[22]
  83. } CDParam;
  84.  
  85. /* use this version for play, scan and stop commands */
  86. typedef struct {
  87.     struct QElem *qLink;
  88.     short qType;
  89.     short ioTrap;
  90.     Ptr ioCmdAddr;
  91.     ProcPtr ioCompletion;
  92.     OSErr ioResult;
  93.     char *ioNamePtr;
  94.     short ioVRefNum;
  95.     short ioCRefNum;
  96.     short csCode;
  97.     short    addrFormat;
  98.     char    unused;
  99.     char    minute;
  100.     char    second;
  101.     char    block;
  102.     short    stopAddress;
  103.     short    playMode;
  104.     char    unused2[12];
  105. } CDPlayParam;
  106.  
  107. /* use this version for pause */
  108. typedef struct {
  109.     struct QElem *qLink;
  110.     short qType;
  111.     short ioTrap;
  112.     Ptr ioCmdAddr;
  113.     ProcPtr ioCompletion;
  114.     OSErr ioResult;
  115.     char *ioNamePtr;
  116.     short ioVRefNum;
  117.     short ioCRefNum;
  118.     short csCode;
  119.     long    pauseMode;    /* 1 = pause, 0 = resume */
  120.     char    unused[18];
  121. } CDPauseParam;
  122.  
  123. typedef struct {
  124.     struct QElem *qLink;
  125.     short qType;
  126.     short ioTrap;
  127.     Ptr ioCmdAddr;
  128.     ProcPtr ioCompletion;
  129.     OSErr ioResult;
  130.     char *ioNamePtr;
  131.     short ioVRefNum;
  132.     short ioCRefNum;
  133.     short csCode;
  134.     char    audioStatus;
  135.     char    playMode;
  136.     char    controlField;
  137.     char    nextMinute;        /* next track absolute start */
  138.     char    nextSecond;
  139.     char    nextBlock;
  140.     char    unused[16];
  141. } CDStatusParam;
  142.  
  143.  
  144. typedef struct {
  145.     struct QElem *qLink;
  146.     short qType;
  147.     short ioTrap;
  148.     Ptr ioCmdAddr;
  149.     ProcPtr ioCompletion;
  150.     OSErr ioResult;
  151.     char *ioNamePtr;
  152.     short ioVRefNum;
  153.     short ioCRefNum;
  154.     short csCode;
  155.     short    readType;
  156.     char    *bufAddr;
  157.     short    bufferLength;
  158.     char    track;
  159.     char    unused[13];
  160. } CDPlay3Param;
  161.  
  162. /* 
  163. ** use this version for disc id, to conform to the id
  164. ** used by the CD Remote.
  165. */
  166. typedef struct {
  167.     struct QElem *qLink;
  168.     short qType;
  169.     short ioTrap;
  170.     Ptr ioCmdAddr;
  171.     ProcPtr ioCompletion;
  172.     OSErr ioResult;
  173.     char *ioNamePtr;
  174.     short ioVRefNum;
  175.     short ioCRefNum;
  176.     short csCode;
  177.     unsigned long    discID;
  178.     char    unused[18];
  179. } CDIDParam;
  180.  
  181. /* 
  182. ** These routines are defined in "FormatStrings.c" and can be used
  183. ** when appropriate in an XFCN or XCMD
  184. */
  185. void    FormatString(char *, long *, long);
  186. void    ltoa(long, char *);
  187. void    reverse(char *);
  188.  
  189. /*
  190. ** These routines are defined in "Programs.c" and can be used
  191. ** when appropriate in an XFCN or XCMD
  192. */
  193. /* prototype definitions for functions */
  194. Boolean    FindIndex(unsigned long, short *);
  195. OSErr    AddDisc(unsigned long, short);
  196. OSErr    AddIndX(unsigned long, short, unsigned short *);
  197. OSErr    AddProG(unsigned short, short);
  198. OSErr    AddTitles(unsigned short, short);
  199. OSErr    IDDisc(short, unsigned long *);
  200. OSErr    GetNumberTracks(short, short *);
  201. void     HandleToPString(Handle, Ptr);
  202. /*
  203. ** These routines are defined in "Track.c" and can be used
  204. ** when appropriate in an XFCN or XCMD
  205. */
  206. OSErr    ReadQ(short, long *, long *, long *, long *);
  207. OSErr    DiscTime(short, long *, long *, long *);
  208. void    TimeDiff(long *, long *, long *, long, long, long, long, long, long);
  209. OSErr    TrackStart(short, long, long *, long *, long *);
  210.  
  211.